package guoanmaker.operator.business.controller;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import guoanmaker.operator.business.model.BackgroundPicture;
import guoanmaker.operator.business.model.InRoundPhone;
import guoanmaker.operator.business.model.OperatorTrademarkPatent;
import guoanmaker.operator.business.service.OperatorTrademarkpatentServiceInterface;
import guoanmaker.operator.helper.common.AjaxJson;
import guoanmaker.operator.helper.common.abstractobj.ApiController;
import io.swagger.annotations.ApiOperation;
/**
 * 商标专利查询app首图
* @ClassName: OperatorTrademarkPatentController
* @Description:TODO (这里用一句话描述这个类的作用) 
* @author lihongyu
* @date 2017年12月18日 下午7:16:26 
*  
 */
@RestController
@RequestMapping(ApiController.OPERATOR_TRADEMARKPATENT)
public class OperatorTrademarkPatentController {
	@SuppressWarnings("unused")
	@Autowired
	private OperatorTrademarkpatentServiceInterface operatorTrademarkpatentServiceInterface;
	 @ApiOperation(value = "保存商标专利查询app首图", notes = "商标专利查询app首图包括新增与修改 ")
	    @PostMapping(value = "saveOperatorTrademarkPatent")
	    public AjaxJson saveBackgroundPicture(@RequestBody InRoundPhone inRoundPhone) {
		 AjaxJson ajaxJson=new AjaxJson();
	    	try{
	    		OperatorTrademarkPatent operatorTrademarkPatent=inRoundPhone.getOperatorTrademarkPatent();
	    		operatorTrademarkPatent.setCitycode(inRoundPhone.getCityId());
	    		operatorTrademarkPatent.setCreateDate(new Date());
	    		OperatorTrademarkPatent    trade = operatorTrademarkpatentServiceInterface.saveOperatorTrademarkPatent(operatorTrademarkPatent);
	        ajaxJson.setSuccess(true).setStatus(200).setData(trade);
	    	}catch(Exception e){
	    		e.printStackTrace();
	    		 ajaxJson.setSuccess(true).setStatus(250).setData(null);
	    	}
	        return ajaxJson;
	    }
	 
	 @ApiOperation(value = "查询商标专利查询app首图", notes = "查询商标专利查询app首图")
	    @PostMapping(value = "getAllOperatorTrademarkPatent")
	  public AjaxJson getAllOperatorTrademarkPatent(String cityId) {
		 AjaxJson ajaxJson=new AjaxJson();
	    	try{
	    		OperatorTrademarkPatent tradepa=operatorTrademarkpatentServiceInterface.selectOperatorTrademarkPatent(cityId);
	        ajaxJson.setSuccess(true).setStatus(200).setData(tradepa);
	        
	    	}catch(Exception e){
	    		e.printStackTrace();
	    		 ajaxJson.setSuccess(false).setStatus(250).setData(null);
	    	}
	    	return ajaxJson;
	    }
}
